//
//  LTViewController.m
//  ios66666
//
//  Created by wangfuren on 14-9-15.
//  Copyright (c) 2014年 lichentao. All rights reserved.
//

#import "LTViewController.h"
#import "LTSecondViewController.h"


#import "MyTableViewCell.h"
@interface LTViewController ()

@end

@implementation LTViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//    self.view.translatesAutoresizingMaskIntoConstraints = NO;
    _table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, self.view.frame.size.height) style:UITableViewStylePlain];
    
//    _table.frame = CGRectZero;
    _table.delegate= self;
    _table.dataSource = self;
//    [_table setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.view addSubview:_table];
//
//    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_table attribute:NSLayoutAttributeCenterX  relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX  multiplier:1.0f constant:0]];
//    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_table attribute:NSLayoutAttributeCenterY  relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY  multiplier:1.0f constant:0]];
//    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_table attribute:NSLayoutAttributeTop  relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop  multiplier:1.0f constant:0]];
//    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_table attribute:NSLayoutAttributeBottom  relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom  multiplier:1.0f constant:0]];
//    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_table attribute:NSLayoutAttributeWidth  relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth  multiplier:0.5f constant:0]];
}

#pragma mark - tableView datasource & delegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 100.f;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    LTSecondViewController *secondView = [[LTSecondViewController alloc] init];
    [self.navigationController pushViewController:secondView animated:YES];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *CellIdentifier = @"hotVideoCellIdentifier";
    MyTableViewCell *cell = (MyTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(nil == cell){
        cell = [[MyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        
    }
    return cell;
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
